package org.example;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.rabbit.core.RabbitMessagingTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author GuoChunbo
 * @create 2021-03-11 8:35
 * @Description: 类的描述
 */
@RestController
public class SenderController {

    @Autowired
    AmqpTemplate amqpTemplate;

    @Autowired
    RabbitMessagingTemplate rabbitMessagingTemplate;

    @RequestMapping("/send")
    public String send(String msg) {
        rabbitMessagingTemplate.convertAndSend("test_exchange","test_direct",msg);
        amqpTemplate.convertAndSend("queue_msg", msg);
        return "OK";
    }


}
